package com.ymatou.iapi.trading.operate.parameter.enums;

/**
 * 码头平台
 */
public enum PlatformEnum {

	UNKNOWN(0),
	YMT_PC(1),
	YMT_WAP(2),
	YMT_APP(3),
	SHANGOU_APP(4),
	SHANGOU_WAP(5),
	SHANGOU_PC(6),
	SHANGOU_WECHAT(7),
	YMT_C2CAPP(8),
	YMT_C2CWAP(9),
	YMT_C2CWECHAT(10),
	YMT_WECHAT(11),
	PURCHASING_PC(12),
	YMT_OTHER(13),
	SHANGOU_OTHER(14),

	;

	private int intValue;
	private static java.util.HashMap<Integer, PlatformEnum> mappings;

	private synchronized static java.util.HashMap<Integer, PlatformEnum> getMappings() {
		if (mappings == null) {
			mappings = new java.util.HashMap<Integer, PlatformEnum>();
		}
		return mappings;
	}

	private PlatformEnum(int value) {
		intValue = value;
		PlatformEnum.getMappings().put(value, this);
	}

	public int getValue() {
		return intValue;
	}

	public static PlatformEnum forValue(int value) {
		return getMappings().get(value);
	}

	public static PlatformEnum getPlatformEnumInfo(String orderSource) {
		String source = orderSource == null ? "" : orderSource.toUpperCase();

		switch (source) {
			case "APP" :
				return PlatformEnum.YMT_APP;
			case "PC" :
				return PlatformEnum.YMT_PC;
			case "WAP" :
				return PlatformEnum.YMT_WAP;
			case "C2CAPP" :
				return PlatformEnum.YMT_C2CAPP;
			case "C2CWAP" :
				return PlatformEnum.YMT_C2CWAP;
			case "C2CWechat" :
				return PlatformEnum.YMT_C2CWECHAT;
			case "Wechat" :
				return PlatformEnum.YMT_WECHAT;
			default :
				return PlatformEnum.YMT_OTHER;
		}
	}
}
